using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Protocol;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.Windows.Media.Imaging;
namespace MicroMsg.Plugin.TXNews
{
	public class TXNews : PluginBase
	{
		private const string TAG = "TXNews";
		public const string PluginKey = "Plugin TXNews";
		public const long PluginID = 32785L;
		public const string PluginName = "TXNews";
		public const int PluginVersion = 256;
		private static TXNews mInstance;
		public override string mTitle
		{
			get
			{
				return strings.Plugin_news_title;
			}
		}
		public override BitmapSource mIcon
		{
			get
			{
				if (MMTheme.IsCoolBlackTheme())
				{
					return ImageCacheMgr.loadFromRes("Source/Plugin/TXNews/Resource/plugin_setting_cool.png");
				}
				return ImageCacheMgr.loadFromRes("Source/Plugin/TXNews/Resource/plugin_setting_normal.png");
			}
		}
		public override BitmapSource mIconHD
		{
			get
			{
				return HeadImgMgr.getHeadImage("newsapp", true);
			}
		}
		public override BitmapSource mIconInList
		{
			get
			{
				return this.mIcon;
			}
		}
		public override string mDescription
		{
			get
			{
				return strings.Plugin_news_hint;
			}
		}
		public override string mAuthor
		{
			get
			{
				return "tencent";
			}
		}
		public TXNews()
		{
			this.mKey = "Plugin TXNews";
			this.mID = 32785L;
			this.mName = "TXNews";
			this.mVersion = 256;
			this.mUserName = ConstantValue.TAG_NEWS;
			this.mIndexInTab = (MainTabIndex)3;
			this.mIndexInGroup = 2;
			this.mIndexInPosition = 0;
			this.mProtocolPluginFlag = EPluginFlag.MM_NEWSAPP_UNINSTALL;
			this.mDefaultInstalled = true;
			TXNews.mInstance = this;
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount.nBindQQ <= 0u && !R.isChineseCN() && (curAccount.nPluginFlag & (uint)this.mProtocolPluginFlag) != 0u)
			{
				this.mEnabled = false;
			}
		}
		public override PluginSettingBaseCtrl GetPluginSettingCtrl()
		{
			return new NewsMsgPluginSetCtrl();
		}
		public static TXNews getInstance()
		{
			return TXNews.mInstance;
		}
		public override void onRegisterResult(RetConst retConst_0, int code)
		{
			Log.smethod_4("TXNews", string.Concat(new object[]
			{
				"on register result , ret = ",
				retConst_0,
				", code = ",
				code
			}));
		}
		public override bool onInitialize()
		{
			Log.smethod_4("TXNews", "initialize. ");
			Account curAccount = AccountMgr.getCurAccount();
			if (!base.isInstalledPlugin() && curAccount != null)
			{
				bool arg_25_0 = AccountMgr.disableRecommendTXNewsToMe;
			}
			return true;
		}
		public override bool onInstalled(InstallMode mode)
		{
			Log.smethod_4("TXNews", "on inistalled. ");
			return true;
		}
		public override bool onUninstalled(InstallMode mode)
		{
			Log.smethod_4("TXNews", "on uninstalled. ");
			NewsMgr.NewsMsgClearAll();
			return true;
		}
		public override bool onParseChatMsg(ChatMsg chatMsg)
		{
			return false;
		}
		public override object execute(int entryType, object args)
		{
			Log.smethod_4("TXNews", "plugin execute,   entrytype =" + entryType);
			if (entryType == 2)
			{
				ToolFunction.GotoPageForUserControl("/Source/Plugin/TXNews/UI/NewsSessionView.xaml", null, false);
			}
			return null;
		}
	}
}
